#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cctype>
using namespace std;
int main()
{
    int p1, p2, p3;
    cin >> p1 >> p2 >> p3;
    getchar();
    string s;
    cin >> s;
    string temp;
    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] != '-')
        {
            temp += s[i];
        }
        else if (s[i] == '-' && ((isdigit(s[i - 1]) && isdigit(s[i + 1])) || (islower(s[i - 1]) && islower(s[i + 1]))))
        {
            if (s[i - 1] >= s[i + 1])
            {
                temp += s[i];
            }
            if (s[i - 1] + 1 < s[i + 1])
            {
                string p;
                for (char t = s[i - 1] + 1; t < s[i + 1]; t++)
                {
                    for (int q = 0; q < p2; q++)
                    {
                        p += t;
                    }
                }
                if (p3 == 2)
                {
                    reverse(p.begin(), p.end());
                }
                if (p1 == 2)
                {
                    transform(p.begin(), p.end(), p.begin(), ::toupper);
                }
                else if (p1 == 3)
                {
                    int len = p.length();
                    p.clear();
                    for (int j = 0; j < len; j++)
                    {
                        p += '*';
                    }
                }
                temp += p;
            }
            if (s[i - 1] + 1 == s[i + 1])
            {
                continue;
            }
        }
        else
        {
            temp += s[i];
        }
    }
    cout << temp;
    return 0;
}
